package org.hope.lee.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.hope.lee.exception.CustomerException;
import org.hope.lee.exception.UserException;
import org.springframework.web.bind.annotation.ExceptionHandler;

public class BaseController {
	
	@ExceptionHandler
	public String exp(HttpServletRequest req, HttpServletResponse resp, Exception ex) {
		req.setAttribute("ex", ex);
		
		if(ex instanceof UserException) {
			return "exception";
		} else if(ex instanceof CustomerException) {
			return "customerException";
		} else {
			return "error";
		}
	}
}
